{{- define "main" }}
{{- $s := .Site.Params }}
{{- $p := .Params }}
{{- $scratch := newScratch }}
{{- if isset $p "image" }}
  {{- $scratch.Set "image" $p.image }}
{{- else }}
  {{ $scratch.Set "image" $s.fallBackOgImage }}
{{- end }}
{{- $image := $scratch.Get "image" }}
{{- $bg := absLangURL (path.Join "images" $image) }}
<article class="post_content">
  {{- $t := .Title }}
  <h1 class="post_title">{{ $t | markdownify }}</h1>
  {{- partial "post/component/post-meta" . }}
  {{- with .Params.featureImage -}}
    <div class="post_featured">
      {{- partial "post/component/image" (dict "file" $p.featureImage "alt" $p.featureImageAlt "cap" $p.featureImageCap "type" "featured" "Page" $.Page) }}
    </div>
  {{- end -}}
  {{ if $p.toc }}
    <div class="post_toc">
      <h2>{{ T "overview" }}</h2>
      {{ .TableOfContents }}
    </div>
  {{ end }}
  <div class="post_body">
    {{- .Content }}
  </div>
  <div class="post_end">END .</div>

  {{- $showComments := true }}
  {{- if eq $s.comments false }}
    {{- $showComments = false }}
  {{- else if eq $p.comments false }}
    {{- $showComments = false }}
  {{- end }}
  {{- if ne $showComments false }}
    {{- partial "post/component/comments" . }}
  {{- end }}

  {{- $showRelatedInArticle := true }}
  {{- if eq $s.showRelatedInArticle false }}
    {{- $showRelatedInArticle = false }}
  {{- else if eq $p.showRelatedInArticle false }}
    {{- $showRelatedInArticle = false }}
  {{- end }}
  {{- if ne $showRelatedInArticle false }}
    {{- partial "post/component/related" . }}
  {{- end }}
  <!-- 模态框：放大查看图片时显示 -->
  <div id="modalImage">
    <div class="content">
      <!-- 用于放大查看的图片 -->
      <img class="image" alt="" src="">
    </div>
    <!-- 关闭按钮 -->
    <span class="close">&times;</span>
  </div>
</article>
{{- end }}
